﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Utility2DLibrary
{
    public class RectangleF
    {
        private Point upperLeft = new Point();
        private Point lowerRight = new Point();
        public float Left
        {
            get { return upperLeft.X; }
            set { upperLeft.X = value; }
        }
        public float Right
        {
            get { return lowerRight.X; }
            set { lowerRight.X = value; }
        }
        public float Top
        {
            get { return upperLeft.Y; }
            set { upperLeft.Y = value; }
        }
        public float Bottom
        {
            get { return lowerRight.Y; }
            set { lowerRight.Y = value; }
        }
        public float Width
        {
            get { return lowerRight.X-upperLeft.X; }
            set { lowerRight.X = upperLeft.X + value; }
        }
        public float Height
        {
            get { return upperLeft.Y - lowerRight.Y; }
            set { lowerRight.Y = upperLeft.Y + value; }
        }
        public Point UpperLeft
        {
            get { return upperLeft; }
            set { upperLeft = value; }
        }
        public Point LowerRight
        {
            get { return lowerRight; }
            set { lowerRight = value; }
        }
        public RectangleF()
        {
            upperLeft = new Point();
            lowerRight = new Point();
        }
        public RectangleF(float left,float top,float right,float bottom)
        {
            upperLeft.X = left;
            upperLeft.Y = top;
            lowerRight.X = right;
            lowerRight.Y = bottom;
        }
        public RectangleF(Point UpperLeft, Point LowerRight)
        {
            upperLeft = UpperLeft;
            lowerRight = LowerRight;
        }
        public RectangleF(RectangleF originalRect)
        {
            this.Left = originalRect.Left;
            this.Top = originalRect.Top;
            this.Right = originalRect.Right;
            this.Bottom = originalRect.Bottom;
        }
        public Rectangle ToIntRect()
        {
            return new Rectangle((int)this.Left, (int)this.Top, (int)this.Right - (int)this.Left, (int)this.Top - (int)this.Bottom);
        }
    }
}
